﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Marmat.Foundation
{
    /// <summary>
    /// 记录选择窗体基础特性。
    /// </summary>
    [EditorBrowsable(EditorBrowsableState.Never)]
    public interface ISelectionRecordBasicForm
    {
        /// <summary>
        /// 获取或设置窗体的标题。
        /// </summary>
        string Text { get; set; }

        /// <summary>
        /// 获取或设置选择对话框的图标。
        /// </summary>
        System.Drawing.Icon Icon { get; set; }

        /// <summary>
        /// 获取或设置选择对话框的大小。
        /// </summary>
        System.Drawing.Size Size { get; set; }

        /// <summary>
        /// 获取或设置是否显示过滤面板。
        /// </summary>
        bool ShowFilterPanel { get; set; }

        /// <summary>
        /// 在计算项高度时执行。
        /// </summary>
        event EventHandler<SelectionRecordFormItemHeightEventArgs> CalcItemHeight;

        /// <summary>
        /// 单元格绘制事件。
        /// </summary>
        event EventHandler<SelectionRecordFormDrawCellEventArgs> DrawCell;

        /// <summary>
        /// 设置需要支持搜索的列。
        /// </summary>
        [Obsolete]
        List<string> SearchCollection { get; }

        /// <summary>
        /// 显示列的集合
        /// </summary>
        SelectionRecordColumnCollection Columns { get; }

        /// <summary>
        /// 生成列集合触发的委托，可在此决定是否列的显示以及顺序等规则。
        /// </summary>
        /// <returns></returns>
        Action<SelectionRecordColumn> ColumnBuilder { get; set; }
    }

    /// <summary>
    /// 记录选择窗体基础特性。
    /// </summary>
    /// <typeparam name="Entity"></typeparam>
    /// <typeparam name="Source"></typeparam>
    [EditorBrowsable(EditorBrowsableState.Never)]
    public interface IBasicSelectionRecordForm<Entity, Source> : ISelectionRecordBasicForm
    {
        /// <summary>
        /// 通过关键字搜索的委托
        /// </summary>
        Func<SelectionRecordFormSearchEventArgs, Source> Search { get; set; }
    }

    /// <summary>
    /// 记录选择窗体基础特性。
    /// </summary>
    /// <typeparam name="Entity"></typeparam>
    /// <typeparam name="Source"></typeparam>
    [EditorBrowsable(EditorBrowsableState.Never)]
    public interface IBasicSelectionRecordPaginationForm<Entity, Source> : ISelectionRecordBasicForm
    {
        /// <summary>
        /// 通过关键字搜索的委托
        /// </summary>
        Func<SelectionRecordFormPaginationSearchEventArgs, Source> Search { get; set; }

        /// <summary>
        /// 获取或设置每页加载的行数。
        /// </summary>
        public int LoadTop { get; }
    }
}
